<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head th:include="/common/inc::header"/>
<body>
<table class="layui-table" id="grid" lay-filter="grid">
</table>
<script th:replace="/common/inc::incJs"></script>
<script>
    var tableIns;
    var id = getQueryString("id");
    var customerId = getQueryString("customerId");

    $(function () {
        var t = new Date();
        tableIns = createTable({
            url: '/backend/security/bill/commissionBillDetailList?withdrawBillId=' + id + '&customerId=' + customerId,
            cols: [[{
                field: 'account2',
                title: '推广用户手机',
                width: 150
            }, {
                field: 'trueName2',
                title: '推广用户姓名',
                width: 150
            },
                {
                    field: 'account',
                    title: '被推广用户手机',
                    width: 150
                }, {
                    field: 'trueName',
                    title: '被推广用户姓名',
                    width: 150
                }, {
                    field: 'profitFee',
                    title: '订单佣金',
                    width: 100
                }, {field: 'createTime', title: '下单时间', width: 170}, {
                    field: 'payDate',
                    title: '支付时间',
                    width: 170
                }, {field: 'billNo', title: '订单编号', width: 220}
                , {field: 'tradeNo', title: '付款凭证号', width: 250}
            ]], height: 'full-50'
        });
    })
    ;

    layui.table.on('tool(grid)', function (obj) { //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
        var data = obj.data; //获得当前行数据
        var layEvent = obj.event; //获得 lay-event 对应的值
        var tr = obj.tr; //获得当前行 tr 的DOM对象

        if (layEvent === 'detail') { //查看
            openDialog({
                url: "/backend/security/bill/detail?id=" + data.id,
                area: ["95%", "95%"]
            });
        } else if (layEvent === 'refund') { //退款
            openDialog({
                url: "",
                area: ["95%", "95%"]
            });
        }
    });

    layui.form.on('submit(searchBtn)', function (data) {
        tableIns.reload({
            where: data.field
        });
        return false;
    });
</script>
<script type="text/html" id="statusTpl">
    {{#  if(d.status ===0){ }}
    <span>待支付</span>
    {{#  } else if(d.status ===1){ }}
    <span style="color: #56b02a;">待入住 </span>
    {{#  }else if(d.status ===2){ }}
    <span style="color: #56b02a;">已入住</span>
    {{#  }else if(d.status ===3){ }}
    <span style="color: #9F9F9F;">已完成</span>
    {{#  }else if(d.status ===4){ }}
    <span style="color: #FF0000;">已取消</span>
    {{#  }else if(d.status ===5){ }}
    <span style="color: blue;">已退费</span>
    {{#  } }}
</script>

<script type="text/html" id="paymentTpl">
    {{#  if(d.payment ==="wechat"){ }}
    <span>微信</span>
    {{#  } }}
</script>
<script type="text/html" id="opbar">
    <a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
    {{# if(d.status==1){ }}
    <a class="layui-btn layui-btn-xs" lay-event="refund">退款</a>
    {{# } }}
</script>
</body>
</html>
